{% extends "../theme/tmpldoc.html" %}
{% block content %}
<ol class="breadcrumb">
      <li>{{ _('Current location') }}: <a href="{% module site_url() %}">{{ _('Home') }}</a></li>
    <li>{{ _('Modify the document') }}</li>
</ol>
<div class="panel panel-black">
    <div class="panel-heading">
        {{ postinfo.title }}-{{ _('Modify the document') }}
    </div>
    <div class="panel-body">
        <form method="post" class="form-horizontal" role="form" id="form_post">
            <fieldset>
                <input type="hidden" id="id_post" name="id_post" value="{{ postinfo.uid }}"/>

                <div class="form-group">
                    <label for="title" class="col-sm-2 control-label">{{ _('Title') }}</label>

                    <div class="col-sm-10">
                        <input type="text" id="title" name="title" value="{{ postinfo.title }}"
                               class="form-control"/>
                    </div>
                </div>


  <div class="form-group">
                    <label class="col-sm-2 control-label" for="tags">{{ _('Label') }}</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="tags" name="tags" type="text"
                               value="{% for x in app2label_info %}
                                    {{ x.tag_name }},
                                    {% end  %}" onchange="chuli_kw()">
                            <br>
                            <div id="kwlist"></div>
                    </div>
                </div>




                {% for ii in range(0,5) %}
                <div class="form-group">
                    {% if ii == 0 %}
                    <label for="pcat0" class="col-sm-2 control-label">{{ _('Category') }}</label>
                    {% else %}
                    <label class="col-sm-2 control-label"></label>
                    {% end %}
                    <div class="col-sm-3">
                        <select name="pcat{{ii}}" id="pcat{{ii}}" class="form-control"
                                onchange="g_load_postcat({{ii}})">
                            <option value="">{{ _('Please select') }}</option>
                            {% for taginfo in tag_infos %}
                            {% if taginfo.uid.endswith('00') %}
                            <option value="{{ taginfo.uid }}"
                                    {% for tt in app2tag_info %}
                                    {% if tt.order== ii and tt.tag_id.startswith(taginfo.uid[:2]) %}
                                    selected
                                    {% end %}
                                    {% end %}>{{ taginfo.name }}
                            </option>
                            {% else %}
                            {% end %}
                            {% end %}
                        </select>
                    </div>

                    <div class="col-sm-4">
                        <select name="gcat{{ii}}" id="gcat{{ii}}" class="form-control">
                            <option value="0">{{ _('Please select') }}</option>
                            {# 设置父类ID，用在下面子类是否显示看 #}
                            {% set pcatid = 'xx' %}
                            {% for taginfo in tag_infos %}
                            {% for tt in app2tag_info %}
                            {% if tt.order== ii and tt.tag_id== taginfo.uid %}
                            {% set pcatid = tt.tag_id[:2] %}
                            {% end %}
                            {% end %}
                            {% end %}

                            {% for taginfo in tag_infos %}
                            {% if taginfo.uid.startswith(pcatid) %}
                            {% if not taginfo.uid.endswith('00') %}
                            <option value="{{ taginfo.uid }}"
                                    {% for tt in app2tag_info %}
                                    {% if tt.order== ii and tt.tag_id== taginfo.uid %}
                                    selected
                                    {% end %}
                                    {% end %}>{{ taginfo.name }}
                            </option>
                            {% else %}
                            {% end %}
                            {% end %}
                            {% end %}

                        </select>
                    </div>

                </div>
                {% end %}

                <div class="form-group">
                    <label for="logo" class="col-sm-2 control-label">{{ _('Picture') }}</label>

                    <div class="col-sm-10">
                        <input id="logo" name="logo" type="text" value="{{ postinfo.logo }}"  class="form-control" readonly />
                        <br>
                        <a class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal">{{ _('Upload picture') }}</a>
                    </div>
                </div>

                <div class="form-group">
                    <label for="cnt_md" class="col-sm-2 control-label">{{ _('Content') }}</label>

                    <div class="col-sm-10">
                        <textarea rows=26 id="cnt_md" name="cnt_md" class="form-control">
                            {% raw unescape(postinfo.cnt_md) %}
                        </textarea>
                    </div>
                </div>
{#                 <div class="form-group">#}
{#                    <label class="col-sm-2 control-label" for="valid">{{ _('Is available') }}</label>#}
{##}
{#                    <div class="col-sm-10">#}
{#                        <select name="valid" id="valid" class="form-control">#}
{#                            <option value="1" {% if postinfo.valid == 1 %} selected {% end %} >{{ _('yes') }}</option>#}
{#                            <option value="0" {% if postinfo.valid == 0 %} selected {% end %} >{{ _('no') }}</option>#}
{#                        </select>#}
{#                    </div>#}
{#                </div>#}
                <div class="form-group">
                    <label for="is_update_time" class="col-sm-2 control-label">{{ _('Update edit time') }}</label>

                    <div class="col-sm-10">
                        <input id="is_update_time" type="radio" name="is_update_time" value="1">{{ _('To update') }}
                        <input id="is_update_time" type="radio" name="is_update_time" value="0" checked>{{ _('Not updated') }}
                    </div>
                </div>
                <div class="form-group">
                    <label for="sub1" class="col-sm-2 control-label"></label>

                    <div class="col-sm-10">
                        <input id="sub1" type="submit" class="btn btn-primary" value="{{ _('Sumbit') }}"/>
                    </div>
                </div>
                <hr/>
            <div class="form-group">
                <label class="col-sm-2 control-label">
                    <a class="glyphicon glyphicon-star" style="color: red;font-size: xx-small;"></a>
                    JSON
                </label>

                <div class="col-sm-10">
                    <textarea class="form-control" rows=26 id="json" name="json" readonly="readonly">
                        {{ kwd['extinfo'] }}
                    </textarea>
                </div>
            </div>
            </fieldset>
        </form>
          {% module upload_pic() %}
    </div>
</div>
{% end %}


